<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-05 15:10:47
 * @LastEditors: 
 * @LastEditTime: 2024-02-05 15:23:33
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 实现一个将接收到的 String 参数转换为一个字母 Union 的类型

type Test = '123';
type Result = StringToUnion<Test>; // expected to be "1" | "2" | "3"

type StringToUnion<T extends string> = T extends `${infer First}${infer Rest}`
  ? First | StringToUnion<Rest> 
  : never;

</script>

<style scoped>

</style>